var mongoose =require('mongoose');
var Schema = mongoose.Schema;
/**
 * member : {
 *    id: userId,
 *    name: username,
 *    gender: usergender,
 *    company: company,
 *    position: position,
 *    business: business,
 *    product: product,
 * }
 * @type {Schema}
 * 建立索引
 * db.factionmembers.ensureIndex({"member.name":1})
 * db.factionmembers.ensureIndex({"member.company":1})
 * db.factionmembers.ensureIndex({"member.position":1})
 * db.factionmembers.ensureIndex({"member.business":1})
 * db.factionmembers.ensureIndex({"member.product":1})
 *
 * scorelog:{
 *      act: actId,
 *      score: score,
 *      time: time
 * }
 * permission:{
 *      showCard: true
 * }
 */
var FactionMember = new Schema({
    faction: {type: Schema.Types.ObjectId, ref: 'Faction'},
    member: {type: Schema.Types.Mixed },
    score: {type: Number, default: 0},
    scorelog: {type: Schema.Types.Mixed},
    permission: {type: Schema.Types.Mixed}
})


mongoose.model('FactionMember', FactionMember);